import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import copy from 'rollup-plugin-copy';
import path from 'path';

// https://vitejs.dev/config/
export default defineConfig({
  assetsInclude: ['**/*.obj', '**/*.gltf', '**/*.glb'],
  plugins: [
    react(),
    copy({
      targets: [
        { src: 'src/model', dest: 'dist' },
      ],
      hook: 'writeBundle',
      verbose: true, // 在终端进行console.log
    })],
  server: {
    open: true,
    port: 8888
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
      stream: 'stream-browserify',
    },
  },
})
